/*
 *  Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */

/*
 *  THIS FILE IS AUTOGENERATED. DO NOT MODIFY IT; ALL CHANGES WILL BE LOST IN
 *  VAIN.
 *
 *  @generated
 */

namespace carbon {
namespace test {
namespace thrift {

template <class Writer>
void TestRequest::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, key_ref());
  writer.writeField(2 /* field id */, dummy2_ref());
  writer.writeField(3 /* field id */, testBool_ref());
  writer.writeField(4 /* field id */, testChar_ref());
  writer.writeField(5 /* field id */, testInt8_ref());
  writer.writeField(6 /* field id */, testInt16_ref());
  writer.writeField(7 /* field id */, testInt32_ref());
  writer.writeField(8 /* field id */, testInt64_ref());
  writer.writeField(9 /* field id */, testUInt8_ref());
  writer.writeField(10 /* field id */, testUInt16_ref());
  writer.writeField(11 /* field id */, testUInt32_ref());
  writer.writeField(12 /* field id */, testUInt64_ref());
  writer.writeField(13 /* field id */, testFloat_ref());
  writer.writeField(14 /* field id */, testDouble_ref());
  writer.writeField(15 /* field id */, testShortString_ref());
  writer.writeField(16 /* field id */, testLongString_ref());
  writer.writeField(17 /* field id */, testIobuf_ref());
  writer.writeField(19 /* field id */, testList_ref());
  writer.writeField(20 /* field id */, testOptionalString_ref());
  writer.writeField(21 /* field id */, testOptionalIobuf_ref());
  writer.writeField(22 /* field id */, dummy22_ref());
  writer.writeField(23 /* field id */, dummy23_ref());
  writer.writeField(24 /* field id */, testNestedVec_ref());
  writer.writeField(25 /* field id */, testUMap_ref());
  writer.writeField(26 /* field id */, testMap_ref());
  writer.writeField(27 /* field id */, testComplexMap_ref());
  writer.writeField(28 /* field id */, testUSet_ref());
  writer.writeField(29 /* field id */, testSet_ref());
  writer.writeField(30 /* field id */, testOptionalBool_ref());
  writer.writeField(31 /* field id */, dummy31_ref());
  writer.writeField(32 /* field id */, testIOBufList_ref());
  writer.writeField(33 /* field id */, testF14FastMap_ref());
  writer.writeField(34 /* field id */, testF14NodeMap_ref());
  writer.writeField(35 /* field id */, testF14ValueMap_ref());
  writer.writeField(36 /* field id */, testF14VectorMap_ref());
  writer.writeField(37 /* field id */, testF14FastSet_ref());
  writer.writeField(38 /* field id */, testF14NodeSet_ref());
  writer.writeField(39 /* field id */, testF14ValueSet_ref());
  writer.writeField(40 /* field id */, testF14VectorSet_ref());
  writer.writeField(41 /* field id */, testOptionalKeywordString_ref());
  writer.writeField(42 /* field id */, testOptionalKeywordIobuf_ref());
  writer.writeField(43 /* field id */, testOptionalKeywordBool_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestRequest::visitFields(V&& v) {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
  if (!v.visitField(2, "dummy2", *this->dummy2_ref())) {
    return;
  }
  if (!v.visitField(3, "testBool", *this->testBool_ref())) {
    return;
  }
  if (!v.visitField(4, "testChar", *this->testChar_ref())) {
    return;
  }
  if (!v.visitField(5, "testInt8", *this->testInt8_ref())) {
    return;
  }
  if (!v.visitField(6, "testInt16", *this->testInt16_ref())) {
    return;
  }
  if (!v.visitField(7, "testInt32", *this->testInt32_ref())) {
    return;
  }
  if (!v.visitField(8, "testInt64", *this->testInt64_ref())) {
    return;
  }
  if (!v.visitField(9, "testUInt8", *this->testUInt8_ref())) {
    return;
  }
  if (!v.visitField(10, "testUInt16", *this->testUInt16_ref())) {
    return;
  }
  if (!v.visitField(11, "testUInt32", *this->testUInt32_ref())) {
    return;
  }
  if (!v.visitField(12, "testUInt64", *this->testUInt64_ref())) {
    return;
  }
  if (!v.visitField(13, "testFloat", *this->testFloat_ref())) {
    return;
  }
  if (!v.visitField(14, "testDouble", *this->testDouble_ref())) {
    return;
  }
  if (!v.visitField(15, "testShortString", *this->testShortString_ref())) {
    return;
  }
  if (!v.visitField(16, "testLongString", *this->testLongString_ref())) {
    return;
  }
  if (!v.visitField(17, "testIobuf", *this->testIobuf_ref())) {
    return;
  }
  if (!v.visitField(19, "testList", *this->testList_ref())) {
    return;
  }
  if (!v.visitField(20, "testOptionalString", this->testOptionalString_ref())) {
    return;
  }
  if (!v.visitField(21, "testOptionalIobuf", this->testOptionalIobuf_ref())) {
    return;
  }
  if (!v.visitField(22, "dummy22", *this->dummy22_ref())) {
    return;
  }
  if (!v.visitField(23, "dummy23", *this->dummy23_ref())) {
    return;
  }
  if (!v.visitField(24, "testNestedVec", *this->testNestedVec_ref())) {
    return;
  }
  if (!v.visitField(25, "testUMap", *this->testUMap_ref())) {
    return;
  }
  if (!v.visitField(26, "testMap", *this->testMap_ref())) {
    return;
  }
  if (!v.visitField(27, "testComplexMap", *this->testComplexMap_ref())) {
    return;
  }
  if (!v.visitField(28, "testUSet", *this->testUSet_ref())) {
    return;
  }
  if (!v.visitField(29, "testSet", *this->testSet_ref())) {
    return;
  }
  if (!v.visitField(30, "testOptionalBool", this->testOptionalBool_ref())) {
    return;
  }
  if (!v.visitField(31, "dummy31", *this->dummy31_ref())) {
    return;
  }
  if (!v.visitField(32, "testIOBufList", *this->testIOBufList_ref())) {
    return;
  }
  if (!v.visitField(33, "testF14FastMap", *this->testF14FastMap_ref())) {
    return;
  }
  if (!v.visitField(34, "testF14NodeMap", *this->testF14NodeMap_ref())) {
    return;
  }
  if (!v.visitField(35, "testF14ValueMap", *this->testF14ValueMap_ref())) {
    return;
  }
  if (!v.visitField(36, "testF14VectorMap", *this->testF14VectorMap_ref())) {
    return;
  }
  if (!v.visitField(37, "testF14FastSet", *this->testF14FastSet_ref())) {
    return;
  }
  if (!v.visitField(38, "testF14NodeSet", *this->testF14NodeSet_ref())) {
    return;
  }
  if (!v.visitField(39, "testF14ValueSet", *this->testF14ValueSet_ref())) {
    return;
  }
  if (!v.visitField(40, "testF14VectorSet", *this->testF14VectorSet_ref())) {
    return;
  }
  if (!v.visitField(41, "testOptionalKeywordString", this->testOptionalKeywordString_ref())) {
    return;
  }
  if (!v.visitField(42, "testOptionalKeywordIobuf", this->testOptionalKeywordIobuf_ref())) {
    return;
  }
  if (!v.visitField(43, "testOptionalKeywordBool", this->testOptionalKeywordBool_ref())) {
    return;
  }
}

template <class V>
void TestRequest::visitFields(V&& v) const {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
  if (!v.visitField(2, "dummy2", *this->dummy2_ref())) {
    return;
  }
  if (!v.visitField(3, "testBool", *this->testBool_ref())) {
    return;
  }
  if (!v.visitField(4, "testChar", *this->testChar_ref())) {
    return;
  }
  if (!v.visitField(5, "testInt8", *this->testInt8_ref())) {
    return;
  }
  if (!v.visitField(6, "testInt16", *this->testInt16_ref())) {
    return;
  }
  if (!v.visitField(7, "testInt32", *this->testInt32_ref())) {
    return;
  }
  if (!v.visitField(8, "testInt64", *this->testInt64_ref())) {
    return;
  }
  if (!v.visitField(9, "testUInt8", *this->testUInt8_ref())) {
    return;
  }
  if (!v.visitField(10, "testUInt16", *this->testUInt16_ref())) {
    return;
  }
  if (!v.visitField(11, "testUInt32", *this->testUInt32_ref())) {
    return;
  }
  if (!v.visitField(12, "testUInt64", *this->testUInt64_ref())) {
    return;
  }
  if (!v.visitField(13, "testFloat", *this->testFloat_ref())) {
    return;
  }
  if (!v.visitField(14, "testDouble", *this->testDouble_ref())) {
    return;
  }
  if (!v.visitField(15, "testShortString", *this->testShortString_ref())) {
    return;
  }
  if (!v.visitField(16, "testLongString", *this->testLongString_ref())) {
    return;
  }
  if (!v.visitField(17, "testIobuf", *this->testIobuf_ref())) {
    return;
  }
  if (!v.visitField(19, "testList", *this->testList_ref())) {
    return;
  }
  if (!v.visitField(20, "testOptionalString", this->testOptionalString_ref())) {
    return;
  }
  if (!v.visitField(21, "testOptionalIobuf", this->testOptionalIobuf_ref())) {
    return;
  }
  if (!v.visitField(22, "dummy22", *this->dummy22_ref())) {
    return;
  }
  if (!v.visitField(23, "dummy23", *this->dummy23_ref())) {
    return;
  }
  if (!v.visitField(24, "testNestedVec", *this->testNestedVec_ref())) {
    return;
  }
  if (!v.visitField(25, "testUMap", *this->testUMap_ref())) {
    return;
  }
  if (!v.visitField(26, "testMap", *this->testMap_ref())) {
    return;
  }
  if (!v.visitField(27, "testComplexMap", *this->testComplexMap_ref())) {
    return;
  }
  if (!v.visitField(28, "testUSet", *this->testUSet_ref())) {
    return;
  }
  if (!v.visitField(29, "testSet", *this->testSet_ref())) {
    return;
  }
  if (!v.visitField(30, "testOptionalBool", this->testOptionalBool_ref())) {
    return;
  }
  if (!v.visitField(31, "dummy31", *this->dummy31_ref())) {
    return;
  }
  if (!v.visitField(32, "testIOBufList", *this->testIOBufList_ref())) {
    return;
  }
  if (!v.visitField(33, "testF14FastMap", *this->testF14FastMap_ref())) {
    return;
  }
  if (!v.visitField(34, "testF14NodeMap", *this->testF14NodeMap_ref())) {
    return;
  }
  if (!v.visitField(35, "testF14ValueMap", *this->testF14ValueMap_ref())) {
    return;
  }
  if (!v.visitField(36, "testF14VectorMap", *this->testF14VectorMap_ref())) {
    return;
  }
  if (!v.visitField(37, "testF14FastSet", *this->testF14FastSet_ref())) {
    return;
  }
  if (!v.visitField(38, "testF14NodeSet", *this->testF14NodeSet_ref())) {
    return;
  }
  if (!v.visitField(39, "testF14ValueSet", *this->testF14ValueSet_ref())) {
    return;
  }
  if (!v.visitField(40, "testF14VectorSet", *this->testF14VectorSet_ref())) {
    return;
  }
  if (!v.visitField(41, "testOptionalKeywordString", this->testOptionalKeywordString_ref())) {
    return;
  }
  if (!v.visitField(42, "testOptionalKeywordIobuf", this->testOptionalKeywordIobuf_ref())) {
    return;
  }
  if (!v.visitField(43, "testOptionalKeywordBool", this->testOptionalKeywordBool_ref())) {
    return;
  }
}

template <class Writer>
void TestReply::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, result_ref());
  writer.writeField(2 /* field id */, valInt32_ref());
  writer.writeField(3 /* field id */, valInt64_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestReply::visitFields(V&& v) {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
  if (!v.visitField(2, "valInt32", *this->valInt32_ref())) {
    return;
  }
  if (!v.visitField(3, "valInt64", *this->valInt64_ref())) {
    return;
  }
}

template <class V>
void TestReply::visitFields(V&& v) const {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
  if (!v.visitField(2, "valInt32", *this->valInt32_ref())) {
    return;
  }
  if (!v.visitField(3, "valInt64", *this->valInt64_ref())) {
    return;
  }
}

template <class Writer>
void TestRequestStringKey::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, key_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestRequestStringKey::visitFields(V&& v) {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
}

template <class V>
void TestRequestStringKey::visitFields(V&& v) const {
  if (!v.visitField(1, "key", *this->key_ref())) {
    return;
  }
}

template <class Writer>
void TestReplyStringKey::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, result_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestReplyStringKey::visitFields(V&& v) {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
}

template <class V>
void TestReplyStringKey::visitFields(V&& v) const {
  if (!v.visitField(1, "result", *this->result_ref())) {
    return;
  }
}

template <class Writer>
void TestOptionalBool::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, optionalBool_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestOptionalBool::visitFields(V&& v) {
  if (!v.visitField(1, "optionalBool", this->optionalBool_ref())) {
    return;
  }
}

template <class V>
void TestOptionalBool::visitFields(V&& v) const {
  if (!v.visitField(1, "optionalBool", this->optionalBool_ref())) {
    return;
  }
}

template <class Writer>
void TestUnion::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  switch (getType()) {
    case 1: {
      writer.writeFieldAlways(1 /* field id */, *a_ref());
      break;
    }
    case 2: {
      writer.writeFieldAlways(2 /* field id */, *b_ref());
      break;
    }
    case 3: {
      writer.writeFieldAlways(3 /* field id */, *c_ref());
      break;
    }
    default:
      break;
  }
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestUnion::visitFields(V&& v) {
  switch (getType()) {
    case 1:
      v.visitField(1, "a", *a_ref());
      break;
    case 2:
      v.visitField(2, "b", *b_ref());
      break;
    case 3:
      v.visitField(3, "c", *c_ref());
      break;
    default:
      break;
  }
}

template <class V>
void TestUnion::visitFields(V&& v) const {
  switch (getType()) {
    case 1:
      v.visitField(1, "a", *a_ref());
      break;
    case 2:
      v.visitField(2, "b", *b_ref());
      break;
    case 3:
      v.visitField(3, "c", *c_ref());
      break;
    default:
      break;
  }
}

template <class V>
void TestUnion::foreachMember(V&& v) {
  if (!v.template visitUnionMember<uint64_t>("a", [this]() -> uint64_t& {return this->a_ref().emplace();})) {
    return;
  }
  if (!v.template visitUnionMember<uint32_t>("b", [this]() -> uint32_t& {return this->b_ref().emplace();})) {
    return;
  }
  if (!v.template visitUnionMember<uint16_t>("c", [this]() -> uint16_t& {return this->c_ref().emplace();})) {
    return;
  }
}

template <class Writer>
void TestF14Containers::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, fastMap_ref());
  writer.writeField(2 /* field id */, nodeMap_ref());
  writer.writeField(3 /* field id */, valueMap_ref());
  writer.writeField(4 /* field id */, vectorMap_ref());
  writer.writeField(5 /* field id */, fastSet_ref());
  writer.writeField(6 /* field id */, nodeSet_ref());
  writer.writeField(7 /* field id */, valueSet_ref());
  writer.writeField(8 /* field id */, vectorSet_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestF14Containers::visitFields(V&& v) {
  if (!v.visitField(1, "fastMap", *this->fastMap_ref())) {
    return;
  }
  if (!v.visitField(2, "nodeMap", *this->nodeMap_ref())) {
    return;
  }
  if (!v.visitField(3, "valueMap", *this->valueMap_ref())) {
    return;
  }
  if (!v.visitField(4, "vectorMap", *this->vectorMap_ref())) {
    return;
  }
  if (!v.visitField(5, "fastSet", *this->fastSet_ref())) {
    return;
  }
  if (!v.visitField(6, "nodeSet", *this->nodeSet_ref())) {
    return;
  }
  if (!v.visitField(7, "valueSet", *this->valueSet_ref())) {
    return;
  }
  if (!v.visitField(8, "vectorSet", *this->vectorSet_ref())) {
    return;
  }
}

template <class V>
void TestF14Containers::visitFields(V&& v) const {
  if (!v.visitField(1, "fastMap", *this->fastMap_ref())) {
    return;
  }
  if (!v.visitField(2, "nodeMap", *this->nodeMap_ref())) {
    return;
  }
  if (!v.visitField(3, "valueMap", *this->valueMap_ref())) {
    return;
  }
  if (!v.visitField(4, "vectorMap", *this->vectorMap_ref())) {
    return;
  }
  if (!v.visitField(5, "fastSet", *this->fastSet_ref())) {
    return;
  }
  if (!v.visitField(6, "nodeSet", *this->nodeSet_ref())) {
    return;
  }
  if (!v.visitField(7, "valueSet", *this->valueSet_ref())) {
    return;
  }
  if (!v.visitField(8, "vectorSet", *this->vectorSet_ref())) {
    return;
  }
}

template <class Writer>
void TestStdContainers::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, fastMap_ref());
  writer.writeField(2 /* field id */, nodeMap_ref());
  writer.writeField(3 /* field id */, valueMap_ref());
  writer.writeField(4 /* field id */, vectorMap_ref());
  writer.writeField(5 /* field id */, fastSet_ref());
  writer.writeField(6 /* field id */, nodeSet_ref());
  writer.writeField(7 /* field id */, valueSet_ref());
  writer.writeField(8 /* field id */, vectorSet_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void TestStdContainers::visitFields(V&& v) {
  if (!v.visitField(1, "fastMap", *this->fastMap_ref())) {
    return;
  }
  if (!v.visitField(2, "nodeMap", *this->nodeMap_ref())) {
    return;
  }
  if (!v.visitField(3, "valueMap", *this->valueMap_ref())) {
    return;
  }
  if (!v.visitField(4, "vectorMap", *this->vectorMap_ref())) {
    return;
  }
  if (!v.visitField(5, "fastSet", *this->fastSet_ref())) {
    return;
  }
  if (!v.visitField(6, "nodeSet", *this->nodeSet_ref())) {
    return;
  }
  if (!v.visitField(7, "valueSet", *this->valueSet_ref())) {
    return;
  }
  if (!v.visitField(8, "vectorSet", *this->vectorSet_ref())) {
    return;
  }
}

template <class V>
void TestStdContainers::visitFields(V&& v) const {
  if (!v.visitField(1, "fastMap", *this->fastMap_ref())) {
    return;
  }
  if (!v.visitField(2, "nodeMap", *this->nodeMap_ref())) {
    return;
  }
  if (!v.visitField(3, "valueMap", *this->valueMap_ref())) {
    return;
  }
  if (!v.visitField(4, "vectorMap", *this->vectorMap_ref())) {
    return;
  }
  if (!v.visitField(5, "fastSet", *this->fastSet_ref())) {
    return;
  }
  if (!v.visitField(6, "nodeSet", *this->nodeSet_ref())) {
    return;
  }
  if (!v.visitField(7, "valueSet", *this->valueSet_ref())) {
    return;
  }
  if (!v.visitField(8, "vectorSet", *this->vectorSet_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumUInt32::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumUInt32::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumUInt32::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumUInt16::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumUInt16::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumUInt16::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumUInt8::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumUInt8::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumUInt8::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumInt32::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumInt32::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumInt32::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumInt16::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumInt16::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumInt16::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithEnumInt8::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithEnumInt8::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithEnumInt8::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", *this->testEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumUInt32::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumUInt32::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumUInt32::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumUInt16::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumUInt16::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumUInt16::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumUInt8::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumUInt8::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumUInt8::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumInt32::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumInt32::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumInt32::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumInt16::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumInt16::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumInt16::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class Writer>
void StructWithOptionalEnumInt8::serialize(Writer&& writer) const {
  writer.writeStructBegin();
  writer.writeField(1 /* field id */, testEnum_ref());
  writer.writeField(2 /* field id */, testEmptyEnum_ref());
  writer.writeFieldStop();
  writer.writeStructEnd();
}

template <class V>
void StructWithOptionalEnumInt8::visitFields(V&& v) {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}

template <class V>
void StructWithOptionalEnumInt8::visitFields(V&& v) const {
  if (!v.visitField(1, "testEnum", this->testEnum_ref())) {
    return;
  }
  if (!v.visitField(2, "testEmptyEnum", this->testEmptyEnum_ref())) {
    return;
  }
}
} // namespace thrift
} // namespace test
} // namespace carbon

namespace apache {
namespace thrift {
template <>
class Cpp2Ops<carbon::test::TestRequest> {
 public:
  typedef carbon::test::TestRequest Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestReply> {
 public:
  typedef carbon::test::TestReply Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestRequestStringKey> {
 public:
  typedef carbon::test::TestRequestStringKey Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestReplyStringKey> {
 public:
  typedef carbon::test::TestReplyStringKey Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestOptionalBool> {
 public:
  typedef carbon::test::TestOptionalBool Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestUnion> {
 public:
  typedef carbon::test::TestUnion Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestF14Containers> {
 public:
  typedef carbon::test::TestF14Containers Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::TestStdContainers> {
 public:
  typedef carbon::test::TestStdContainers Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumUInt32> {
 public:
  typedef carbon::test::StructWithEnumUInt32 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumUInt16> {
 public:
  typedef carbon::test::StructWithEnumUInt16 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumUInt8> {
 public:
  typedef carbon::test::StructWithEnumUInt8 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumInt32> {
 public:
  typedef carbon::test::StructWithEnumInt32 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumInt16> {
 public:
  typedef carbon::test::StructWithEnumInt16 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithEnumInt8> {
 public:
  typedef carbon::test::StructWithEnumInt8 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumUInt32> {
 public:
  typedef carbon::test::StructWithOptionalEnumUInt32 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumUInt16> {
 public:
  typedef carbon::test::StructWithOptionalEnumUInt16 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumUInt8> {
 public:
  typedef carbon::test::StructWithOptionalEnumUInt8 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumInt32> {
 public:
  typedef carbon::test::StructWithOptionalEnumInt32 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumInt16> {
 public:
  typedef carbon::test::StructWithOptionalEnumInt16 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};

template <>
class Cpp2Ops<carbon::test::StructWithOptionalEnumInt8> {
 public:
  typedef carbon::test::StructWithOptionalEnumInt8 Type;
  static constexpr protocol::TType thriftType() {
    return protocol::T_STRUCT;
  }
  template <class Protocol>
  static uint32_t write(Protocol* prot, const Type* value) {
    return value->write(prot);
  }
  template <class Protocol>
  static void read(Protocol* prot, Type* value) {
    value->read(prot);
  }
  template <class Protocol>
  static uint32_t serializedSize(Protocol* prot, const Type* value) {
    return value->serializedSize(prot);
  }
  template <class Protocol>
  static uint32_t serializedSizeZC(Protocol* prot, const Type* value) {
    return value->serializedSizeZC(prot);
  }
};
} // namespace thrift
} // namespace apache
